<div class="layui-breadcrumb nepadmin-breadcrumb" lay-filter="nepadmin-breadcrumb">
    <a lay-href="/">首页</a>
    <a>新增模块</a>
    <a>
        <cite>loarBar</cite>
    </a>
</div>
<div class="layui-fluid" id="VIEW-module-loadbar" lay-title="loadBar 模块">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-lg12">
            <div class="layui-card">
                <div class="layui-card-header">加载进度条</div>
                <div class="layui-card-body">
                    <button class="loarbar-test layui-btn layui-btn-normal" data-type="start">开始 Start</button>
                    <button class="loarbar-test layui-btn layui-btn-normal" data-type="finish">结束 Finish</button>
                    <button class="loarbar-test layui-btn layui-btn-normal" data-type="error">错误 Error</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
layui.use(['loadBar'], function (loadBar) {
    var $ = layui.jquery;
    var view = $('#VIEW-module-loadbar');
    view.find('.loarbar-test').on('click',function(){
        var type = $(this).attr('data-type');
        loadBar[type]();
    })


    window.onload=function(){
        var menu=document.getElementById("menu");

        document.oncontextmenu=function(ev){
            var ev=ev||event;
            var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;

            menu.style.display="block";
            menu.style.left=ev.clientX+"px";
            //当滑动滚动条时也能准确获取菜单位置
            menu.style.top=ev.clientY+scrollTop+"px";
            //阻止默认事件
            return false;
        }

    }

})
</script>